import type { FormSchema } from '@/components/core/schema-form/';

export const schemas: FormSchema[] = [
  {
    field: 'caseName',
    component: 'Input',
    label: '①',
    rules: [{ required: true, message: '请输入案件名称' }],
    componentProps: () => {
      return {
        placeholder: '请输入案件名称',
      };
    },
  },
  {
    field: 'executeWay',
    component: 'Select',
    label: '',
    rules: [{ required: true, message: '请选择下列情形' }],
    componentProps: ({ formInstance }) => {
      return {
        placeholder: '请选择下列情形',
        options: [
          {
            label: '违法行为已过追究时效',
            value: '1',
            key: '1',
          },
          {
            label: '涉嫌违法的公民死亡，或者法人、其他组织终止',
            value: '2',
            key: '2',
          },
          {
            label: '没有违法事实的',
            value: '3',
            key: '3',
          },
          {
            label: '其他',
            value: '4',
            key: '4',
          },
        ],
        onChange: (e: any) => {
          const { updateSchema } = formInstance;
          if (e == 4) {
            updateSchema({
              field: 'content',
              vShow: true,
              label: '②',
              rules: [{ required: true, message: '请输入其他内容' }],
            });
          } else {
            updateSchema({
              field: 'content',
              vShow: false,
            });
          }
        },
      };
    },
  },
  {
    field: 'content',
    component: 'Input',
    label: '②',
    vShow: false,
    componentProps: () => {
      return {
        placeholder: '请输入其他内容',
      };
    },
  },
];
